# 基础镜像（预装字体+安全更新）
FROM adoptopenjdk/openjdk8-openj9:jdk8u442-b06_openj9-0.49.0-alpine-slim

# 元数据
LABEL maintainer="chensn" app.name="yyds6"

# 时区与语言
ENV TZ=Asia/Shanghai \
    LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
RUN apk add --no-cache tzdata && \
    cp /usr/share/zoneinfo/$TZ /etc/localtime && \
    echo $TZ > /etc/timezone

# 添加应用
ADD target/fun.yyds6-v1.0.0-SNAPSHOT.jar /app.jar

# 端口暴露
EXPOSE 9996

# 健康检查
HEALTHCHECK --interval=30s --timeout=5s \
    CMD curl -f http://localhost:9996/actuator/health || exit 1

# 启动命令
ENTRYPOINT ["java", "-server", 
    "-Djava.security.egd=file:/dev/./urandom",
    "-DAPP_NAME=yyds6",
    "-XX:MetaspaceSize=128m", "-XX:MaxMetaspaceSize=256m",
    "-XX:+UseG1GC", "-XX:MaxGCPauseMillis=200",
    "-Xss512k", "-XX:+ExplicitGCInvokesConcurrent",
    "-jar", "/app.jar"
]